<?php

/**
 * @author lioxca
 * @copyright 2012
 */

    include_once($_SERVER['DOCUMENT_ROOT'].'/LLKH/Models/LoaiTinHoc.php');

    
    class TinHoc extends LoaiTinHoc{
        private $mucdo;
        
                        
        public function setMucDo($mucdo){
            $this->mucdo = $mucdo;
        }
        public function getMucDo(){
            return $this->mucdo;
        }
        
        
        
        
        public function themTinHoc(){
            $query = "insert into TinHoc(ND_ID,LTH_Ma,TH_MucDo) values ('".$this->getMaSo()."',
            '".$this->getLTHMa()."','".$this->getMucDo()."') ";
            $this->setQuery($query);
            //echo $this->getQuery();
            return $this->executeQuery();
        }
        public function suaTinHoc(){
            $query = "update TinHoc set TH_MucDo='".$this->getMucDo()."' 
            where LTH_Ma='".$this->getLTHMa()."'";
            $this->setQuery($query);
            return $this->executeQuery();
        }
        public function xoaTinHoc(){
            $this->setQuery("delete from TinHoc where ND_ID='".$this->getMaSo()."' and LTH_Ma='".$this->getLTHMa()."'");
            return $this->executeQuery();
        }
        public function thongtinTinHoc(){
            $query = "select ND_ID,a.LTH_Ma as LTH_Ma,LTH_Ten,TH_MucDo from TinHoc a,LoaiTinHoc b";
            $query .= " where a.LTH_Ma=b.LTH_Ma and ND_ID='".$this->getMaSo()."'";            
            $this->setQuery($query);
            return $this->fetchAll();
        }
        public function dsTinHoc(){
            $this->setQuery("select * from TinHoc");
            return $this->fetchAll();
        }
    }

?>